package Thread;

public class MyRunnable implements java.lang.Runnable {
    @Override
    public void run() {
        while (true){
            try {
                Thread.sleep(1000);
                System.out.println("hello myrunnable");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
class Dom2{
    public static void main(String[] args) throws InterruptedException {
        Runnable runnable=new MyRunnable();
        Thread t=new Thread(runnable);
        t.start();
        while (true){
            Thread.sleep(1000);
            System.out.println("hello main!");
        }
    }
}
